__author__ = 'el_even'

from selenium.webdriver.common.by import By

from php4dvd.pages.internalpage import InternalPage


class AddMoviePage(InternalPage):
    """
    The add movie page description
    """

    @property
    def is_this_page(self):
        return self.is_element_visible((By.CSS_SELECTOR, ".addmovie"))

#    @property
    def is_error(self):
        return self.is_element_visible((By.XPATH, ".//label[@class='error']"))

    @property
    def imdb_id_input(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='imdbid']")

    @property
    def movie_title_input(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='name']")

    @property
    def aka_textarea(self):
        return self.driver.find_element(By.XPATH, ".//textarea[@name='aka']")

    @property
    def year_input(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='year']")

    @property
    def duration_input(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='duration']")

    @property
    def rating_input(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='rating']")

    @property
    def format_input(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='format']")

    @property
    def submit_button(self):
        return self.driver.find_element(By.XPATH, ".//input[@name='submit']")
